<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
    <TITLE>Class Template filter</TITLE>
    <LINK REL="stylesheet" HREF="../../../../boost.css">
    <LINK REL="stylesheet" HREF="../theme/iostreams.css">
</HEAD>
<BODY>

<!-- Begin Banner -->

    <H1 CLASS="title">Class Template <CODE>filter</CODE></H1>
    <HR CLASS="banner">

<!-- End Banner -->

<DL class="page-index">
  <DT><A href="#description">Description</A></DT>
  <DT><A href="#headers">Headers</A></DT>
  <DT><A href="#reference">Reference</A></DT>
</DL>

<HR>

<A NAME="description"></A>
<H2>Description</H2>

<P>
    The class templates <CODE>filter</CODE>, <CODE>wfilter</CODE>, <CODE>multichar_filter</CODE>, <CODE>multichar_wfilter</CODE> and their specializations are provided by the Iostreams library for use as base classes for user-defined <A HREF="../concepts/filter.html">Filters</A>. These base classes supply the member types <CODE>char_type</CODE> and <CODE>category</CODE> used internally by the Iostreams library to classify filters.
</P>
<P>
    The supplied <CODE>category</CODE> member is convertible to <A HREF="../guide/traits.html#category_tags"><CODE>closable_tag</CODE></A> and to <A HREF="../guide/traits.html#category_tags"><CODE>localizable_tag</CODE></A>. This allows users to define models of the concepts <A HREF="../concepts/closable.html">Closable</A> and <A HREF="../concepts/closable.html">Localizable</A> simply by providing definitions of member functions <CODE>close</CODE> and <CODE>imbue</CODE>.
</P>

<A NAME="headers"></A>
<H2>Headers</H2>

<DL class="page-index">
  <DT><A CLASS="header" HREF="../../../../boost/iostreams/concepts.hpp"><CODE>&lt;boost/iostreams/concepts.hpp&gt;</CODE></A></DT>
</DL>

<A NAME="reference"></A>
<H2>Reference</H2>

<A NAME="synopsis"></A>
<H3>Synopsis</H3>

<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost{ <SPAN CLASS="keyword">namespace</SPAN> iostreams {

<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">char</SPAN>&gt;
<SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#description">filter</A>;

<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">wchar_t</SPAN>&gt;
<SPAN CLASS="keyword">struct</SPAN> <SPAN CLASS="defined">wfilter</SPAN> : filter&lt;Mode, Ch&gt; { };

<SPAN CLASS="keyword">typedef</SPAN> filter&lt;input&gt;      input_filter;
<SPAN CLASS="keyword">typedef</SPAN> wfilter&lt;input&gt;     input_wfilter;
<SPAN CLASS="keyword">typedef</SPAN> filter&lt;output&gt;     output_filter;
<SPAN CLASS="keyword">typedef</SPAN> wfilter&lt;output&gt;    output_wfilter;
<SPAN CLASS="keyword">typedef</SPAN> filter&lt;seekable&gt;   seekable_filter;
<SPAN CLASS="keyword">typedef</SPAN> wfilter&lt;seekable&gt;  seekable_wfilter;
<SPAN CLASS="keyword">typedef</SPAN> filter&lt;dual_use&gt;   dual_use_filter;
<SPAN CLASS="keyword">typedef</SPAN> wfilter&lt;dual_use&gt;  dual_use_wfilter;

<SPAN CLASS="keyword"><SPAN CLASS="keyword">template</SPAN></SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">char</SPAN>&gt;
<SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#multichar_filter">multichar_filter</A> : filter&lt;Mode, Ch&gt; {
    <SPAN CLASS="keyword">typedef</SPAN> <A STYLE="text-decoration:none" HREF="#category"><SPAN CLASS="omitted">see below</SPAN></A>  category;
};

<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">wchar_t</SPAN>&gt;
<SPAN CLASS="keyword">struct</SPAN> <SPAN CLASS="defined">multichar_wfilter</SPAN> : multichar_filter&lt;Mode, Ch&gt; { };

<SPAN CLASS="keyword">typedef</SPAN> multichar_filter&lt;input&gt;     multichar_input_filter;
<SPAN CLASS="keyword">typedef</SPAN> multichar_filter&lt;input&gt;     multichar_input_wfilter;
<SPAN CLASS="keyword">typedef</SPAN> multichar_filter&lt;output&gt;    multichar_output_filter;
<SPAN CLASS="keyword">typedef</SPAN> multichar_filter&lt;output&gt;    multichar_output_wfilter;
<SPAN CLASS="keyword">typedef</SPAN> multichar_filter&lt;dual_use&gt;  multichar_dual_use_filter;
<SPAN CLASS="keyword">typedef</SPAN> multichar_filter&lt;dual_use&gt;  multichar_dual_use_wfilter;

<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#filter_template_params">Mode</A>, <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#filter_template_params">Ch</A> = <SPAN CLASS="keyword">char</SPAN>&gt;
<SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#filter">filter</A> {
    <SPAN CLASS="keyword">typedef</SPAN> Ch         char_type;
    <SPAN CLASS="keyword">typedef</SPAN> <A STYLE="text-decoration:none" HREF="#category"><SPAN CLASS="omitted">see below</SPAN></A>  category;

    <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Device&gt;
    <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(Device&amp;);

    <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Device&gt;
    <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(Device&amp;, std::ios_base::openmode);

    <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#imbue">imbue</A>(<SPAN CLASS="keyword">const</SPAN> std::locale&amp;);
};

} } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE>

<A NAME="filter"></A>
<H3>Class Template <CODE>filter</CODE></H3>

<H4>Description</H4>

<P>Convenience base class for defining <A HREF="../concepts/filter.html">Filters</A></P>

<A NAME="filter_template_params"></A>
<H4>Template parameters</H4>

<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
    <TR>
        <TD VALIGN="top"><I>Mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
        <TD>A <A HREF="../guide/modes.html#mode_tags">mode tag</A>.</TD>
    </TR>
    <TR>
        <TD VALIGN="top"><I>Ch</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
        <TD>The character type</TD>
    </TR>
</TABLE>

<A NAME="category"></A>
<H4><CODE>filter::category</CODE></H4>

<PRE CLASS="broken_ie">    <SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="omitted">see below</SPAN> category;</PRE>

<P>
    A category tag convertible to <A HREF="#filter_template_params"><CODE>Mode</CODE></A>, <A HREF="../guide/traits.html#category_tags"><CODE>filter_tag</CODE></A>, <A HREF="../guide/traits.html#category_tags"><CODE>closable_tag</CODE></A> and <A HREF="../guide/traits.html#category_tags"><CODE>localizable_tag</CODE></A>.
</P>
    
<A NAME="close"></A>
<H4><CODE>filter::close</CODE></H4>

<PRE CLASS="broken_ie">    <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Device&gt;
    <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(Device&amp;);

    <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Device&gt;
    <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(Device&amp;, std::ios_base::openmode);</PRE>

<P>
    Both overloads are implemented as no-ops. The second is available only if <A HREF="#filter_template_params">Mode</A> is convertible to <A HREF="../guide/modes.html#mode_tags"><CODE>bidirectional</CODE></A>. The first is available only if Mode is <I>not</I> convertible to <A HREF="../guide/modes.html#mode_tags"><CODE>bidirectional</CODE></A>.
</P>
<P>
    Required by <A HREF="../concepts/closable.html">Closable</A>.
</P>

<A NAME="imbue"></A>
<H4><CODE>filter::imbue</CODE></H4>
<PRE CLASS="broken_ie">    <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#imbue">imbue</A>(<SPAN CLASS="keyword">const</SPAN> std::locale&amp;);</PRE>

<P>
    Implemented as a no-op. Required by <A HREF="../concepts/localizable.html">Localizable</A>.
</P>

<A NAME="multichar_filter"></A>
<H3>Class Template <CODE>multichar_filter</CODE></H3>

<H4>Description</H4>

<P>Convenience base class for defining <A HREF="../concepts/multi_character.html">Multi-Character Filters</A>. Derived class of <A HREF="#filter"><CODE>filter</CODE></A> whose member type <CODE>category</CODE> is convertible to the template parameter Mode and to <A HREF="../guide/traits.html#category_tags"><CODE>multichar_filter_tag</CODE></A>, <A HREF="../guide/traits.html#category_tags"><CODE>closable_tag</CODE></A> and <A HREF="../guide/traits.html#category_tags"><CODE>localizable_tag</CODE></A>.</P>

<A NAME="multichar_filter_template_params"></A>
<H4>Template parameters</H4>

<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
    <TR>
        <TD VALIGN="top"><I>Mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
        <TD>A <A HREF="../guide/modes.html#mode_tags">mode tag</A>.</TD>
    </TR>
    <TR>
        <TD VALIGN="top"><I>Ch</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
        <TD>The character type</TD>
    </TR>
</TABLE>

<!-- Begin Footer -->

<HR STYLE="margin-top:2em">

<P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P>
<P CLASS="copyright"> 
    Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)
</P>

<!-- End Footer -->

</BODY>
